class Task59:
    def run(self, array, window_size):
        result = []
        if len(array) < window_size:
            return result

        queue = []
        index = 0
        for _ in range(window_size):
            while len(queue) > 0 and array[queue[-1]] < array[index]:
                queue.pop()
            queue.append(index)
            index += 1
        result.append(array[queue[0]])

        while index < len(array):
            if queue[0] <= index - window_size:
                queue.pop(0)
            while len(queue) > 0 and array[queue[-1]] < array[index]:
                queue.pop()
            queue.append(index)
            index += 1
            result.append(array[queue[0]])

        return result
